package com.jmag.nop.storageweb.controller;

import com.jmag.nop.service.common.annotation.ApiMapping;
import com.jmag.nop.storageapi.service.TStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jmag
 */
@RestController
//@RequestMapping("storage")
public class TStorageController {

    @Autowired
    private TStorageService storageServiceImpl;

    /**
     * 扣减库存
     * @param productId 产品id
     * @param count 数量
     * @return
     */
    @RequestMapping("/storage/decrease")
    //@ApiMapping("storage.decrease")
    public String decrease(@RequestParam("productId") Long productId,@RequestParam("count") Integer count){
        storageServiceImpl.decrease(productId,count);
        return "Decrease storage success";
    }
}
